package io.renren.controller;

import io.renren.service.XlsUserService;
import io.renren.utils.AppResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


/**
 * 消费明细
 *
 * @author Mark sunlightcs@gmail.com
 * @since 1.0.0 2020-04-12
 */
@RestController
@RequestMapping("/api/xlsUser")
@Api(tags="用户中心")
public class XlsUserController {
    @Autowired
    private XlsUserService xlsUserService;

    /**
     * 个人中心
     *
     * @param userId
     * @return
     */
    @PostMapping("/myCenterData")
    @ApiOperation("个人中心")
    public AppResult myCenterData(Long userId){
        return xlsUserService.myCenterData(userId);
    }


    /**
     * 二维码分享
     * userId    用户id
     */
    @GetMapping("/qrCodeShare")
    @ApiOperation("二维码分享")
    public AppResult qrCodeShare(Long userId){
        return xlsUserService.qrCodeShare(userId);
    }

    /**
     * 我邀请的人
     * userId    用户id
     */
    @GetMapping("/fans")
    @ApiOperation("我邀请的人")
    public AppResult fans(Long userId){
        return xlsUserService.fans(userId);
    }

    /**
     * 邀请我的
     * userId    用户id
     */
    @GetMapping("/promotePeople")
    @ApiOperation("邀请我的")
    public AppResult promotePeople(Long userId){
        return xlsUserService.promotePeople(userId);
    }


    /**
     * 修改密码
     */
    @PostMapping("/updatePassword")
    @ApiOperation("修改密码")
    public AppResult updatePassword(Long userid, String oldPassword, String newPassword, String types, String userPhone){
        return xlsUserService.updatePassword(userid,oldPassword,newPassword,types,userPhone);
    }

    /**
     * 修改支付密码
     */
    @RequestMapping("/updatePayPassword")
    @ApiOperation("修改支付密码")
    public AppResult updatePayPassword(Long userid, String oldPayPassword, String newPayPassword){
        return xlsUserService.updatePayPassword(userid,oldPayPassword,newPayPassword);
    }

    /**
     * 设置二级密码
     */
    @RequestMapping("/setPayPassword")
    @ApiOperation("设置二级密码")
    public AppResult setPayPassword(Long userid, String newPayPassword){
        return xlsUserService.setPayPassword(userid,newPayPassword);
    }




}